<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=yZKmNclFuwfV4iwGBWxMEkRcUMRQGbQB"></script>
<script src="{{asset('/js/jquery-1.8.3.min.js')}}"></script>
<style type="text/css">
    /*body, html{*/
    /*width: 100%;height: 100%;overflow: hidden;margin:0;*/
    /*font-family:"微软雅黑";*/
    /*}*/
    #allmap {
        width: 50%;
        height: 200px;
    }

    #r-result {
        width: 50%;
        margin-top: 5px;
    }

    p {
        margin: 5px;
        font-size: 14px;
    }
</style>
<form action="{{url('/u/'.$details['user_id'].'/update')}}" method="post"
      enctype="multipart/form-data"
      class="warp mdui-shadow-2 mdui-p-a-1">
    {{csrf_field()}}
    {{--昵称--}}
    <div class="mdui-textfield mdui-p-a-2">
        <label class="mdui-textfield-label">昵称</label>
        <input class="mdui-textfield-input" type="text" name="nickname"
               value="{{$details['nickname']}}"/>
    </div>


    {{--邮箱--}}
    <div class="mdui-textfield mdui-p-a-2">
        <label class="mdui-textfield-label">手机</label>
        <input class="mdui-textfield-input" {{($details['phone']!= null)? "disabled":''}} type="text" name="phone"
               value="{{($details['phone']!= null)? $details['phone']:''}}"/>
    </div>

    {{--邮箱--}}
    <div class="mdui-textfield mdui-p-a-2">
        <label class="mdui-textfield-label">邮箱</label>
        <input class="mdui-textfield-input" {{($details['email']!= null)? "disabled":''}} type="text" name="email"
               value="{{($details['email']!= null)? $details['email']:''}}"/>
    </div>

    {{--性别--}}
    <div class="mdui-textfield mdui-p-a-2">
        <label class="mdui-textfield-label">性别</label>
        <label class="mdui-radio">
            <input type="radio" name="sex" value="0" {{$details['sex']==0?'checked':''}}/>
            <i class="mdui-radio-icon"></i>男
        </label>
        <label class="mdui-radio">
            <input type="radio" name="sex" value="1" {{$details['sex']==1?'checked':''}}/>
            <i class="mdui-radio-icon"></i>女
        </label>
        <label class="mdui-radio">
            <input type="radio" name="sex" value="2" {{$details['sex']==2?'checked':''}}/>
            <i class="mdui-radio-icon"></i>保密
        </label>
    </div>

    {{--地址--}}
    <div class="mdui-row-xs-2 mdui-p-a-2">
        <div class="mdui-col mdui-textfield mdui-p-r-2">
            <label class="mdui-textfield-label">地址</label>
            <select class="mdui-textfield-input" id="pro" name="pro" level="1">
                <option value="{{$address[0]!=0?$address[0]:0}}">{{$add[0]?$add[0]:'省份'}}</option>
            </select>
            <select class="mdui-textfield-input" id="city" name="city">
                <option value="{{$address[1]!=0?$address[1]:0}}">{{$add[1]?$add[1]:'城市'}}</option>
            </select>
            <select class="mdui-textfield-input" id="county" name="county">
                <option value="{{$address[2]!=0?$address[2]:0}}">{{$add[2]?$add[2]:'区县'}}</option>
            </select>
        </div>
        {{--百度地图--}}
        <div id="allmap" class="mdui-col mdui-shadow-2"></div>
        {{--<div id="r-result" class="mdui-grid-tile-actions mdui-grid-tile-actions-gradient">
            <div class="mdui-grid-tile-text">
                <div class="mdui-grid-tile-title">
                    <input type="button" onclick="add_control();" value="添加"/>
                    <input type="button" onclick="delete_control();" value="删除"/>
                </div>
            </div>
        </div>--}}
    </div>
    <a href="{{url('/u/'.$details['id'])}}" class="mdui-btn mdui-ripple">返回</a>
    <input id="submit" type="submit" class="mdui-btn mdui-ripple mdui-color-blue" value="保存">
</form>

<script type="text/javascript">
    // 百度地图API功能
    var map = new BMap.Map("allmap");  // 创建Map实例
    map.centerAndZoom($(("option:selected")[1].text != '市区') ? $("option:selected")[1].text : '北京', 10);      // 初始化地图,用城市名设置地图中心点
    var top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});// 左上角，添加比例尺
    var top_left_navigation = new BMap.NavigationControl();  //左上角，添加默认缩放平移控件
    var top_right_navigation = new BMap.NavigationControl({
        anchor: BMAP_ANCHOR_TOP_RIGHT,
        type: BMAP_NAVIGATION_CONTROL_SMALL
    }); //右上角，仅包含平移和缩放按钮
    /*缩放控件type有四种类型:
     BMAP_NAVIGATION_CONTROL_SMALL：仅包含平移和缩放按钮；BMAP_NAVIGATION_CONTROL_PAN:仅包含平移按钮；BMAP_NAVIGATION_CONTROL_ZOOM：仅包含缩放按钮*/

    //添加控件和比例尺
    function add_control() {
        map.addControl(top_left_control);
        map.addControl(top_left_navigation);
        map.addControl(top_right_navigation);
    }
    //移除控件和比例尺
    function delete_control() {
        map.removeControl(top_left_control);
        map.removeControl(top_left_navigation);
        map.removeControl(top_right_navigation);
    }
</script>

